package com.codingman.jpademo1;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;

@Entity
@Table(name = "employee")
public class Employee {
	@Id
	@Column(name = "id")
	private Integer id;

	@Column(unique = true, nullable = false)
	private String name;

	private Double salary;

	@Transient
	private String convertedName;

	public Employee(Integer id, String name, Double salary) {
		this.id = id;
		this.name = name;
		this.salary = salary;
	}

	public Employee() {

	}

	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
		this.convertedName = doConvertName(name);
	}

	public Double getSalary() {
		return salary;
	}

	public void setSalary(Double salary) {
		this.salary = salary;
	}

	public String getConvertedName() {
		return convertedName;
	}

	protected String doConvertName(String name) {
		return name.toUpperCase();
	}
}
